<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="./lib/vue.js"></script>
  </head>
  <body>
    <div id="app">
      <input type="number" v-model.number="num1" step="1" />
      +
      <input type="number" v-model.number="num2" step="1" />
      <button @click="addClick">计算</button>
      <p>计算结果是： <span>{{sum}}</span></p>
    </div>
    <script>
      /*  var vm = */ new Vue({
        el: "#app",
        data() {
          return {
            num1: "",
            num2: "",
            sum: "",
          };
        },
        methods: {
          addClick() {
            this.sum = this.num1 + this.num2;
          },
        },
      });
    </script>
  </body>
</html>
